﻿using System;
using System.Linq.Expressions;
using System.Windows;
using PersonaLibrary.Data;
using PersonaLibrary.Search;

namespace PersonaLibrary.Commands.SearchCommands
{
    internal sealed class NavigateToCommand<T> : CommandBase
        where T : IDBEntity
    {
        public override bool CanExecute(object parameter)
        {
            return (parameter != null) && (((App)Application.Current).ServerAvailable);
        }

        public override void Execute(object parameter)
        {
            ((App)Application.Current).Filter = new AlphabetFilter(typeof(T), false){ DisplayName = parameter.ToString() };
        }
    }
}
